import Cookies from 'js-cookie'

const TokenKey = 'weight_token'
const CountdownKey = 'weight_countdown'
const IsLoginKey = 'weight_login'
const UserInfoKey = 'weight_user'
const IsAdmInfoKey = 'weight_admin'

// 获取Token
export function getToken() {
  return Cookies.get(TokenKey)
}


export function getLogin() {
  return Cookies.get(IsLoginKey)=='true'?true:false
}

export function setLogin(login) {
  return Cookies.set(IsLoginKey, login)
}

export function removeLogin() {
  return Cookies.remove(IsLoginKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

export function getCountdown() {
  return Cookies.get(CountdownKey)
}

export function setCountdown(countdown) {
  return Cookies.set(CountdownKey, countdown)
}

export function removeCountdown() {
  return Cookies.remove(CountdownKey)
}

export function getUserInfo() {
  return Cookies.get(UserInfoKey)
}

export function setUserInfo(info) {
  return Cookies.set(UserInfoKey, info)
}

export function removeUserInfo() {
  return Cookies.remove(UserInfoKey)
}

export function getIsAdmin() {
  return Cookies.get(IsAdmInfoKey)=='true'?true:false
}

export function setIsAdmin(info) {
  return Cookies.set(IsAdmInfoKey, info)
}

export function removeIsAdmin() {
  return Cookies.remove(IsAdmInfoKey)
}
